generator: Still create /run/ostree in static prepareroot path
authorColin Walters <walters@verbum.org>
Wed, 9 Apr 2025 22:33:40 +0000 (22:33 +0000)
committerColin Walters <walters@verbum.org>
Wed, 9 Apr 2025 22:33:40 +0000 (22:33 +0000)
commitf22fb92da5ecdb59f725592c3c830df10afa55aa
tree8d70d6ee1dd4cfb0ead0632cf4cfd0be5a3cd329
parenteecf887aaafba6211024636aea6de79769645d97
generator: Still create /run/ostree in static prepareroot path

Ref https://github.com/ostreedev/ostree/pull/3406

There's a combination of two commits here that broke the static
prepareroot path:

ec1109c7a93a2ed07503b12ffecf7048cf7cc0d0
"generator: Stop creating `/run/ostree-booted`"
and more recently
b9ce0e89801bbc92d50473d3620b3f41f1dbef9f
generator: Exit if there's no `/run/ostree`

Basically when run via a non-static prepareroot we create
`/run/ostree-booted` consistently in the initramfs,
using the kernel argument presence as source of truth.

But for the static prepareroot, the generator checked
the kernel argument, and had a fallback of creating it.

Except that's busted in the case of running in a
container, where with many runtimes we still
default to seeing the host's commandline (which
is basically wrong...but fixing that requires a
userspace virtualizer/interceptor for `/proc`
so it's not commonly done).

This should fix the static prepareroot path
by detecting the case where we're compiled
with a static prepareroot, and if so we then
hardcode creating the `/run/ostree-booted`
file in the generator. I think basically
everyone who is compiling ostree with
a static prepareroot *and* including it
in their filesystem trees can be pretty
much guaranteed to be actually using it.
Makefile-libostree.am
src/libostree/ostree-impl-system-generator.c